Skip to content

date: fix the strftime O and E modifier leaks #11656#11714

Closed
tobyw21 wants to merge 70 commits intouutils:mainfrom
tobyw21:tobyw21-date-patch
Closed

date: fix the strftime O and E modifier leaks #11656#11714
tobyw21 wants to merge 70 commits intouutils:mainfrom
tobyw21:tobyw21-date-patch

Conversation

@tobyw21
Copy link
Copy Markdown

@tobyw21 tobyw21 commented Apr 8, 2026

This PR fixes date: strftime with O and E modifiers. Fixes #11656

Changes

  • change regex in coreutils/src/uu/date/src/format_modifiers.rs:82 to %([_OE0^#+-]*)(\d*)(:*[a-zA-Z])
  • add tests for O and E modifiers

Limitations

None

Build requirements

Rust stable

Testing

Tested with make test

before

$ LC_ALL=C TZ=UTC target/debug/coreutils date -d '2024-06-15' '+%Om-%Oy-%Ol'
%Om-%Oy-%Ol
$ echo $?
0

after

$ LC_ALL=C TZ=UTC target/debug/coreutils date -d '2024-06-15' '+%Om-%Oy-%Ol'
06-24-12
$ echo $?
0

@tobyw21 tobyw21 force-pushed the tobyw21-date-patch branch from 32c54ca to 0af8e02 Compare April 8, 2026 12:43
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

GNU testsuite comparison:

Skip an intermittent issue tests/date/resolution (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/tail/symlink (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/date/date-locale-hour (passes in this run but fails in the 'main' branch)
Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)
Congrats! The gnu test tests/expand/bounded-memory is now passing!
Congrats! The gnu test tests/printf/printf-surprise is now passing!

* tests/by-util/test_tail.rs (test_follow_name_multiple): Increase
the delay on macOS to 2000ms to avoid intermittent failures due to
slower follow-name change detection on macOS CI.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

GNU testsuite comparison:

GNU test failed: tests/tail/pipe-f2. tests/tail/pipe-f2 is passing on 'main'. Maybe you have to rebase?
GNU test failed: tests/tail/retry. tests/tail/retry is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/tty/tty-eof (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/tail/tail-n0f is now being skipped but was previously passing.
Congrats! The gnu test tests/expand/bounded-memory is now passing!
Congrats! The gnu test tests/printf/printf-surprise is now passing!

sylvestre and others added 24 commits April 9, 2026 11:34
Use `rustix::process::test_kill_process` (a safe wrapper around
`kill(pid, 0)`) to eliminate the remaining `unsafe` blocks in
src/uu/tail/src/platform/unix.rs. This removes the direct `libc::kill`
calls and the `get_errno` helper, replacing them with idiomatic
`match` on `rustix::io::Errno` variants.
…ils#11716)

* fix(numfmt):fix recision loss for large numbers in uutils#11654

* numfmt: fix some tests in format.rs caused by importing numeric.rs

* add a file header and remove a redundant comment

* remove a redundant comment

* add a empty line between two functions

* refactor(numfmt): rename helper functions for accuracy; fix double negation logic
* forbid scientific notation arguments in numfmt

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Edit solution of #116555

* add scientific notation test

* change variable name

* use is_ascii_digit() instead of checking manually

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

* Apply suggestion from @cakebaker

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
uutils#11683)

* Update format.rs

* numfmt fix uutils#11667

* numfmt --format fix

* remove ignore of test for uutils#11667 in test_numfmt.rs

* Add space after slashes in a comment

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>

* change is_precision with a more understandable name

* Leave an empty line between functions

---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
* numfmt: fix --to=auto to return with exitcode=1

* numfmt: update direct variable use in format macro

* numfmt_test: remove extra test

* numfmt: replacing format in translate directly
Per-binary comparison script that reads the existing
individual-size-result.json format (date-keyed with sha + sizes-in-KB)
and reports binaries whose size changed by both >=5% and >=4 KB.

This is the size-tracking counterpart of compare_test_results.py: it
emits GitHub workflow annotations and writes a PR comment body to its
--output path only when there is something significant to report.
Replace the inline shell loop that walked individual-size-result.json
with a call to util/compare_size_results.py and write its output, plus
the PR number, into a size-comment/ directory uploaded as an artifact.

The aggregate `multiple binaries` and `multicall binary` checks remain
inline since they are simple scalar comparisons. The new artifact is
consumed by the SizeComment workflow to post a PR comment, mirroring
the GnuTests / GnuComment pipeline.
oech3 and others added 27 commits April 12, 2026 16:30
Upstream commit 9f50c8b ("tee: fix input with sleep") already
contains the functional fix for short reads from a paused writer.
Keep the regression coverage so we do not reintroduce the bug.

The test writes one small chunk, waits long enough for a buggy tee to
exit, then writes a second chunk and asserts both stdout and the output
file receive both writes.
test_single_quote_pair_as_delimiter_is_invalid is intermittent on
i686: the parent writes "a''b\n" to cut's stdin while cut validates
args and exits immediately with "delimiter must be a single
character". On a fast child exit, the kernel closes the pipe
read-end before the parent's write() runs, so write() returns
EPIPE and the pipe_in thread panics.

The race is inherent: draining stdin in cut before exiting on an
arg error would hang on terminals and read unbounded data from
long pipes, contradicting GNU behavior. Use the test framework's
ignore_stdin_write_error() flag, which exists for exactly this
"parent writes to child that exits fast" pattern.
The `+1` accounting for the ACL/context indicator was applied once per
item inside the padding loop, so N files with ACLs inflated the
link-count column width by N. Apply it a single time after the loop.

Fixes uutils#10980
fix warning:

```
WARNING: apt does not have a stable CLI interface. Use with caution in scripts.
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

date: strftime O modifier leaks as literal in C locale